#pragma once

#include "VisioCommon.h"
#include "ImageData.h"
#include "TrackDataBase.h"
#include "ImageMatch.h"
#include <vector>
#include <map>

typedef std::vector<CImageData> ImageDataVector;
typedef std::vector<string> ImageNamesVector;
typedef std::pair<UINT, UINT> ImageIndexMatch;
typedef std::map<ImageIndexMatch, CImageMatch*> MatchesMap;
typedef std::pair<ImageIndexMatch, CImageMatch*> MatchMapElement;
typedef std::pair<MatchesMap::iterator, bool> MatchMapInsertReturnType;
typedef std::vector<CImageData*> ImageDataPtrVector;

typedef std::vector<SSharedView> SharedViewVector;

class CImageDataBase
{
public:
	void LoadImageData(char* ImageDataFile, ImageNamesVector ImagesName);
	void LoadMatches(char* MatchesFile);
	void SetTracks(CTrackDataBase* pTracks);
	CImageData* GetImageData(UINT index);
	ImageIndexMatch GetBestInitialPair();
	UINT GetNumImages() const;
	CImageMatch* GetMatchFromIndex(UINT i, UINT j) const;
	CImageMatch* GetMatchFromIndex(ImageIndexMatch match) const;

	//given an index  return the VisablePoints shared by image(index) and the points we already found
	UINT GetNumTracksCorespanding( UINT index, VisiblePointsVector& VisablePoints );

	SharedViewVector GetTracksShared(ImageDataPtrVector indices);
private:
	UINT m_NumImages;
	ImageDataVector m_ImageData;
	CTrackDataBase* m_pTrackDataBase;
	MatchesMap m_MatchesMap;
};
